package com.anyun.collect.fragments

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import com.anyun.collect.R
import com.anyun.collect.adapter.PointListAdapter
import com.anyun.collect.bean.PointData
import com.anyun.collect.customview.SimpleDividerItemDecoration
import kotlinx.android.synthetic.main.recyclerview.view.*

/**collect
 * Created by lzw on 2019/12/4. 17:31:00
 * 邮箱：632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
class HomeFragment :Fragment(){



    var datas = listOf(
        PointData(1,1,1334.34,2344.232,true),
        PointData(1,2,1334.34,2323.232,true),
        PointData(1,3,1234.34,2344.232,true),
        PointData(1,4,1234.34,2344.232,true),
        PointData(1,5,1234.34,2344.232,true),
        PointData(1,6,1234.34,2344.232,true),
        PointData(1,7,1234.34,2344.232,true),
        PointData(1,8,1234.34,2344.232,true)
        )
    companion object{
        val TAG:String = HomeFragment::class.java.simpleName
        fun newInstance() = HomeFragment()
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val binding = inflater.inflate(R.layout.fragment_home,container,false);
        val adapter = activity?.let { PointListAdapter(it,datas) }
        binding.point_list.apply { addItemDecoration(SimpleDividerItemDecoration(context,20,5)) }
        binding.point_list.adapter = adapter

        return binding.rootView
    }
}